<?php 
function add_field_with_list($label, $label_for, $ul_id, $items = array()){
	$imgsrc = base_url() . "images/site/";
?>
	<div class="input left">
		<div class="camp" >
	        <label for="<?php echo $label_for; ?>">
	        	<?php echo $label ;?>
	        </label>
	        <input size="45" class="inputtext inpajax" type="text" maxlength="100"  />
	        <a href="javascript:void(0)" title="Adicionar">
	        	<img src="<?php echo $imgsrc; ?>/btn_adicionar.gif" alt="adicionar" class="right" border="0">
	        </a>
	        <br />
	        <ul id="<?php echo $ul_id ;?>">
	        	<?php 
	        		foreach ($items as $item) {
	        			echo "<li onclick=\"excluir('".$ul_id."', this);\">";                                            
						echo    "<img onclick=\"excluir();\" src=\"$imgsrc/il_excluir.gif\" alt=\"excluir\" border=\"0\" >";
						echo 	$item->texto ;                                                                                             
						echo 	"<input type='hidden' value='". $item->texto ."' name='".$ul_id."_value[]'/>" ;            
						echo "</li>";  
	        		}
	        	?>
	        </ul>
		</div>
	</div>
	<div class="clear"></div>
<?php 
}
?>

                                                                                                    